const state = {
  value: "", // 需要共享的值
  isScratchPaper: false, // 是否是草稿纸
  isReviewing: false, // 是否是审核界面
  currentCategory: '',
  currentAlgorithm: '',
};

const mutations = {
  SET_VALUE: (state, value) => {
    state.value = value;
  },
  SET_SCRATCHPAPER: (state, value) => {
    state.isScratchPaper = value;
  },
  SET_ISREVIEWING: (state, value) => {
    state.isReviewing = value;
  },
  SET_CATEGORY(state, category) {
    state.currentCategory = category;
  },
  SET_ALGORITHM(state, algorithm) {
    state.currentAlgorithm = algorithm;
  },
};

const actions = {
  setValue({ commit }, value) {
    commit("SET_VALUE", value);
  },
  setScratchPaper({commit}, value) {
    commit("SET_SCRATCHPAPER", value);
  },
  setIsReviewing({commit}, value) {
    commit("SET_ISREVIEWING", value);
  }
};

export default {
  namespaced: true, // 启用命名空间，避免全局命名冲突
  state,
  mutations,
  actions
};
